import com.alibaba.fastjson.JSON
import com.data.ChatMsg
import netty.NettyClient

fun main(args: Array<String>) {
    println("Hello World!")
    val channel = NettyClient().start(8082)
    println(channel)


    //channel对象可保存在map中，供其它地方发送消息
    //channel.writeAndFlush("reply:Hello Server!")

    Thread.sleep(1 * 1000)


    //channel.writeAndFlush("reply:Hello Server!1000")



    Thread.sleep(1000)
    val chatMsg = ChatMsg(0, "Hello收到服务端响应的消息Hello收到服务端响应的消息Hello收到服务端响应的消息Hello收到服务端响应的消息Hello收到服务端响应的消息Hello收到服务端响应的消息Hello收到服务端响应的消息")
    channel.writeAndFlush(JSON.toJSONString(chatMsg))
    //Thread.sleep(1000)
    //channel.writeAndFlush(chatMsg)

}